/*
 * $Id: UnPackNCopyFilterTask.java,v 1.4 2009/07/24 18:27:04 oliver Exp $
 *
 * Copyright (C) 2006 General Electric Company. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 *
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */

package com.ge.healthcare.autosc.processor.dispatcher.tasks;

import com.ge.healthcare.autosc.common.ASCLogger;
import com.ge.healthcare.autosc.common.database.pojo.ActTask;
import com.ge.healthcare.autosc.common.dbLogger.StepLogger;
import com.ge.healthcare.autosc.processor.dispatcher.tasks.filter.TaskFilter;
import com.ge.healthcare.autosc.processor.dispatcher.tasks.filter.TaskFilterResults;

public class UnPackNCopyFilterTask extends UnPackNCopyTask {
	private static TaskFilter taskFilter;

	public void executeTask(ActTask task) {
		String methodName = "executeTask";
		ASCLogger.debug(this.getClass(), methodName,
				"Received file transfer task for:" + task);
		try {
			this.setUp(task);
			TaskFilterResults result = taskFilter.isEnabled(request);
			if (result.isEnabled()) {
				transferFiles(this.taskFTDetailsLst, this.ftDetailsLst);
				result.append(" Files Transfered");
			}
			StepLogger.addStepLog(result.toString());
		} finally {
			this.complete();
		}
		ASCLogger.debug(this.getClass(), methodName,
				"Completed file transfer task for:" + task);
	}

	/**
	 * @param filter
	 *            the filter to set
	 */
	public void setTaskFilter(TaskFilter taskFilter) {
		UnPackNCopyFilterTask.taskFilter = taskFilter;
	}
}
